package com.huadragon.marathonweb.controller.front.home;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import com.huadragon.marathonentity.servicedomain.NewsDomain;
import com.huadragon.marathonservice.service.inter.INewsService;




@Controller
@RequestMapping("/home")
public class IndexController  {

    /*@Autowired
	private ILoginService loginService;*/
	
	@Autowired
	private INewsService newsService;
    
    /**
	 * 转到登陆页面
	 * @return
	 */
    @RequestMapping(value = "")
	public String index(ModelMap model) {
    	List<NewsDomain> newsList=newsService.SelectHotNewsList(null);
		model.addAttribute("newsList", newsList);
    	//此处可以检测是否登陆，若登陆直接跳转到主页，未登陆则在登陆页面。
    	/*if (LoginUserHolder.getLoginAccount() != null) {
			return "redirect:/";
		}*/
    	return "/front/home/index";
    	//也可以不检测是否登陆，不管登陆与否，都可以显示此页面，让用户再次登陆。
		//return "/manage/account/login";
	}
    
    
}
